package com.yunbiao.ybbusstopplate.utils.core.power;

import android.content.Intent;

import com.yunbiao.ybbusstopplate.base.APP;


/**
 * 庆吉主板
 * Created by Administrator on 2019/1/16.
 */

public class QJAction {
    /**
     * 1.定时开关机接口：

     Intent intent = new Intent("android.intent.action.setpoweronoff");
     int[] on = {2018,7,28,10,41};
     int[] off = {2018,7,28,10,40};
     intent.putExtra("timeon", on);
     intent.putExtra("timeoff", off);
     intent.putExtra("enable", true);
     sendBroadcast(intent);
     */

    /**
     * 已经在系统中添加广播接收功能，所以发送已下广播实现
     */
    //重启
    public final static String ACTION_REBOOT = "android.intent.action.qt.reboot";
    //关机
    public final static String ACTION_SHUTDOWN = "android.intent.action.qt.shutdown";
    //屏幕旋转
    public final static String ROTATION_0 = "android.intent.action.qt.horizontal";
    public final static String ROTATION_90 = "android.intent.action.qt.vertical";
    public final static String ROTATION_180 = "android.intent.action.qt.reverse_horizontal";
    public final static String ROTATION_270 = "android.intent.action.qt.reverse_vertical";

    /**
     * 2.切换信号源接口：

     String str1 = "av";
     String str2 = "vga";
     String str3 = "hdmi";
     String str4 = "home";
     Intent intent = new Intent("android.intent.action.switchinputsource");
     intent.putExtra("inputsource",str1);
     sendBroadcast(intent);
     */

    //输入源切换
    public final static String CHANGE_TO_HDMI = "hdmi";
    public final static String CHANGE_TO_VGA = "vga";
    public final static String CHANGE_TO_AV = "av";
    public final static String CHANGE_TO_HOME = "home";

    public static void SwitchSource(String source){
        Intent intent = new Intent("android.intent.action.switchinputsource");
        intent.putExtra("inputsource",source);
      APP.Companion.getAppContext().sendBroadcast(intent);
    }


    /**
     * 7.截屏
     Intent intent = new Intent("android.intent.action.qt.screenshot");
     sendBroadcast(intent);

     图片产生的路径为/storage/emulated/0/Pictures/Screenshots
     */
    public final static String ACTION_SCREENSHOT = "android.intent.action.qt.screenshot";

    /**
     * 3.关闭屏幕，程序依然运行
     */
    public final static String ACTION_SLEEP="android.action.adtv.sleep";

     /**
     4.开启屏幕，恢复显示
     */
     public final static String ACTION_WAKEUP="android.action.adtv.wakeup";

    /**
     * 发送广播
     * @param action
     */
     public static void switchAction(String action){
         Intent intent = new Intent(action);
       APP.Companion.getAppContext().sendBroadcast(intent);
     }
}
